package com.zhanyf.heilan.cg.dao;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Component;

import com.zhanyf.heilan.cg.domain.Contract;

@Component
public interface ContractMapper {
	@Select(value = "select * from tb_contract order by id limit #{start}, #{limit}")
	public List<Contract> listContractsBriefly(@Param(value = "start") long start, @Param(value = "limit") int limit);

	@Insert(value = "insert into tb_contract(companyName, deptContractId, originalContractId, pl, cyph, composition, color) values(#{companyName},#{deptContractId},#{originalContractId},#{pl},#{cyph},#{composition},#{color})")
	public void addContractBriefly(Contract contract);

	@Delete(value = "delete from tb_contract where id=#{id}")
	public void deleteContractBriefly(Long id);

	@Select(value = "select * from tb_contract where id=#{id}")
	public Contract getContractBriefly(Long id);

	@Update(value = "update tb_contract set companyName=#{companyName},deptContractId=#{deptContractId},originalContractId=#{originalContractId},pl=#{pl},cyph=#{cyph},composition=#{composition},color=#{color} where id=#{id}")
	public void modifyContractBriefly(Contract contract);
}
